@extends('admin.master')
<script src="/js/admin/dealer.js"></script>
@section('title', '经销商管理')
	
@section('firstItem')
@parent
				<span class="linkBtn">经销商管理</span>
				<input class="a_indexbg" type="hidden" value="chargerecords" />
				<div class="exportBtn">导出<img src="/img/admin/exportLogo.png" /></div>
@stop
@section('searchList')
@parent		

<a class="queryBtn dealerQueryBtn">搜索</a>
<div>
	<input class="dealerBox" type="text" placeholder="请输入经销商" value="{{ $dealer }}" />
</div>
<div class="dateList">
	<input type="text" id="startDate" style="width:150px;height: 24px" placeholder="输入起始日期" onclick="layui.laydate({elem: this,format: 'YYYY-MM-DD' })" value="{{ is_null($after_date)? '': $after_date->toDateString() }}">
	<span>至</span>
	<input type="text" id="endDate" style="width:150px;height: 24px" placeholder="输入截止日期" onclick="layui.laydate({elem: this, format: 'YYYY-MM-DD' })" value="{{ is_null($before_date)? '': $before_date->toDateString() }}">
</div>
@stop
@section('dataTables')
@parent
			<table class="rechargeNotes dataTables" cellspacing="0" cellpadding="0">
				<thead>
					<tr>
						<td>序号</td>
						<td>经销商</td>
						<td>设备编号</td>
						<td>用户名</td>
						<td style="width:4%;">剩余流量(L)</td>
						<td>剩余天数(D)</td>
						<td>购买模式</td>
						<td style="width:4%;">购买金额(元)</td>
						<td style="width:4%;">购买流量数(L)</td>
						<td style="width: 4%">购买天数(D)</td>
						<td>购买人</td>
						<td>后台充值人</td>
						<td style="width: 4%">撤销金额(元)</td>
						<td style="width:4%;">撤销流量数(L)</td>
						<td style="width: 4%">撤销天数(D)</td>
						<td>撤销操作人</td>
						<td style="width: 4%">价格(元)</td>
						<td>商户订单号</td>
						<td>备注信息</td>
						<td style="width:7%">日期</td>
					</tr>
				</thead>
				<tbody>
					@for($i=0, $chargeRecordCount=count($charge_records); $i<$chargeRecordCount; $i++)
					<tr >
						<td>{{ $i+1 }}</td>
						<td>{{ $charge_records[$i]->device->installInfo->dealer or '' }}</td>
						<td class="devicecodeVal">{{ $charge_records[$i]->device->code }}</td>
						<td>{{ $charge_records[$i]->device->installInfo->customer_name or '' }}</td>
						<td>{{ $charge_records[$i]->residual_flow or '/'}}</td>
						<td>{{ $charge_records[$i]->time_limit or '/'}}</td>
						@if($charge_records[$i]->recharge_mode == 1)
						<td>套餐模式
						@else<td>计量模式
						@endif
						</td>
						<td>{{ $charge_records[$i]->money or 0 }}</td>
						<td>{{ $charge_records[$i]->flow }}</td>
						<td>{{ $charge_records[$i]->days }}</td>
						<td>{{ $charge_records[$i]->userInfo->name or '' }}</td>
						<td>{{ $charge_records[$i]->adminInfo->name or '' }}</td>
						<td>{{ is_null($charge_records[$i]->discharge_money)? '': $charge_records[$i]->discharge_money}}</td>
						<td>{{ is_null($charge_records[$i]->discharge_flow)? '': $charge_records[$i]->discharge_flow}}</td>
						<td>{{ is_null($charge_records[$i]->discharge_time)? '': $charge_records[$i]->discharge_time}}</td>
						<td>{{ $charge_records[$i]->dischargeAdmin->name or '' }}</td>
						<td>{{ is_null($charge_records[$i]->price)? '': $charge_records[$i]->price}}</td>
						<td>{{ $charge_records[$i]->order_number or '' }}</td>
						<td class="add_text" style="width:180px;">{{ $charge_records[$i]->remark or '' }}</td>
						<td>{{ $charge_records[$i]->created_at }}</td>
					</tr>
					@endfor
				</tbody>
			</table>
@stop
@section('page_num')
<ul class="pagination pagination-lg"> 
	@if(!is_null($charge_records->first()))
	<?php
	$queryParam = ['device_id' => $charge_records->first()->device_id];
	$queryParam = empty($dealer)? $queryParam: array_merge($queryParam, ['dealer' => $dealer]);
	$queryParam = empty($before_date)? $queryParam: array_merge($queryParam, ['before_date' => $before_date->toDateString()]);
	$queryParam = empty($after_date)? $queryParam: array_merge($queryParam, ['after_date' => $after_date->toDateString()]); ?>
	{!! $charge_records->appends($queryParam)->render() !!}
	@endif
</ul>
@stop
@section('infor_promit')
@parent

@stop
